﻿<%@ Page Title="Cungmuanao.com - Quản lý loại sản phẩm" Language="C#" MasterPageFile="~/Admin/Admin.master" 
   ValidateRequest="false" AutoEventWireup="true" CodeFile="ManageDepartments.aspx.cs" Inherits="Admin_ManageDepartments" %>
<%@ Import Namespace="DTO" %>
<%@ Register src="../Controls/FileUploadFullPath.ascx" tagname="FileUpload" tagprefix="uc1" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">

<script type="text/javascript" src="../js/nicEdit.js"></script>
<script type="text/javascript">
    bkLib.onDomLoaded(function () {
        nicEditors.allTextAreas()
    });
</script>
    <div class="title">Quản lý loại sản phẩm</div>
    <div class="body">
<%--<table>                           
 <tr>
    <td valign="middle">
       <b><small>Số sản phẩm hiển thị trên mỗi trang:</small></b>
    </td>
    <td valign="middle">
        <asp:RadioButtonList runat="server" ID="rblPageIndex"  AutoPostBack="true" RepeatDirection="Horizontal" onselectedindexchanged="rblPageIndex_SelectedIndexChanged">
               <asp:ListItem Value="5">5</asp:ListItem>
               <asp:ListItem Value="10" Selected="True">10</asp:ListItem>
               <asp:ListItem Value="25">25</asp:ListItem>
               <asp:ListItem Value="50">50</asp:ListItem>   
               <asp:ListItem Value="100">100</asp:ListItem>
        </asp:RadioButtonList>
    </td>
 </tr>
</table>--%>    
<p></p>
<input type=button onclick="javascript: window.location.href = 'AddEditDepartment.aspx';" value="thêm mới" />
                    
<asp:GridView runat="server" ID="gvwDepartments" Width="100%" 
        AutoGenerateColumns="False" DataSourceID="objAllDepartments" DataKeyNames="ID"
        AllowPaging="True" PageSize="20" EmptyDataText="<b>Chưa có loại sản phẩm nào</b>"
        onrowcreated="gvwDepartments_RowCreated" >
    <Columns>
        <asp:TemplateField HeaderText="No.">
            <ItemStyle HorizontalAlign="Center" />
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblSTT" Text='<%#Container.DataItemIndex + 1 %>' />
            </ItemTemplate>
        </asp:TemplateField>
        
        <asp:ImageField DataImageUrlField="ImageUrl" HeaderText="Image">
         <ItemStyle Width="100px" />
        </asp:ImageField>
        
        <asp:TemplateField HeaderText="Title">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblTitle" Text='<%#Eval("FullTitle")%>' />
            </ItemTemplate>
        </asp:TemplateField>        
        
       <asp:TemplateField HeaderText="No. Products">
            <ItemTemplate>
                <asp:HyperLink runat="server" ID="hplProducts" Text='<%#Eval("CountProduct") %>' NavigateUrl='<%# "~/Admin/ManageProducts.aspx?DepID=" + Eval("ID")%>'  />
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
        </asp:TemplateField>
        
        <asp:TemplateField HeaderText="Description">
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblDescription" Text='<%#Eval("Description") %>' />
            </ItemTemplate>
        </asp:TemplateField>       
        
        <asp:TemplateField HeaderText="Edit" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px">
            <ItemTemplate>
                <asp:HyperLink runat="server" ID="lnkEdit" ToolTip="Edit product"
                    NavigateUrl='<%# "~/Admin/AddEditDepartment.aspx?ID=" + Eval("ID") %>' ImageUrl="~/Images/Edit.gif" />
            </ItemTemplate>         
            <ItemStyle HorizontalAlign="Center" Width="20px"></ItemStyle>
        </asp:TemplateField>           
        
        <asp:CommandField ButtonType="Image" HeaderText="Delete" DeleteImageUrl="~/Images/Delete.gif" DeleteText="Delete department" ShowDeleteButton="True">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:CommandField>
    </Columns>
 </asp:GridView>
 
    <asp:ObjectDataSource ID="objAllDepartments" runat="server" 
        DeleteMethod="DeleteDepartment" SelectMethod="ListDepartments" 
        TypeName="BLL.Store.Department">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
    </asp:ObjectDataSource>
 
    </div>
    <div class="bottom"></div>
</asp:Content>

